%{
/*  yacc parser to read lists. */
#include <stdio.h>
%}

%token LPAREN
%token RPAREN
%token COMMA
%token NUMBER
%%
list:
        LPAREN sequence RPAREN  { printf("L -> [ seq ]\n"); }
   |    LPAREN RPAREN   { printf("L -> [] \n "); }
sequence:  listelement COMMA sequence  { printf("seq -> LE,seq\n"); }
   |       listelement { printf("seq -> LE\n"); } 
   ;

listelement: NUMBER  { printf("LE -> %d\n",$1); }
   |         list    { printf("LE -> L\n"); }
            ;
%%
